package at.codejedi.sto.gui.combat.tree;

import java.text.DateFormat;
import java.util.Calendar;

import at.codejedi.sto.config.Configuration;
import at.codejedi.sto.model.combat.IBattle;

class BattleTreeNode extends TreeNodeWrapper<IBattle> {

	public BattleTreeNode(IBattle wrappedObj) {
		super(wrappedObj);

	}

	private String getBattleName(IBattle battle) {
		Calendar start = Calendar.getInstance();
		start.setTimeInMillis(battle.getPlayersMap().get(0)
				.getBeginningMillis());

		DateFormat sdf = Configuration.getDateTimeFormat();
		return sdf.format(start.getTime());
	}

	@Override
	public String toString() {
		return getBattleName(getWrappedObj());
	}

}